package app;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.lang.management.MemoryType;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import norms.SNorm;
import norms.TNorm;

import linguistic.Qualifier;
import linguistic.Quantifier;
import linguistic.Summarizer;
import linguistic.Quantifier.QuantifierType;
import linguistic.Variable;
import memberships.MembershipFunction;
import memberships.MembershipFunction.Type;
import memberships.Triangular;


import sets.ClassicalSet;
import sets.FuzzySetType1;
import sets.IFuzzySet;
import sets.IntervalFuzzySet1;
import summaries.CombinationGenerator;
import summaries.Generator;
import summaries.Results;
import summaries.Summary;
import universe.Dense;
import universe.IUniverseOfDiscourse;
import utils.ConfigReader;
import utils.Element;
import utils.Interval;
import utils.Point;

public class Application {

	public static void main(String[] args) {
		
		System.out.println("Application start: " + new Date());
		
		try {
			Class.forName("org.sqlite.JDBC");
		} catch (ClassNotFoundException e) {
			System.out.println(e.getMessage());
		}
		
		// Create configuration object instance
		Configuration config = Configuration.getInstance();
		
		// Create configuration reader object
		ConfigReader reader = new ConfigReader();
		reader.setFilename("config.xml");
		reader.start();
		
		/*ObjectReader objects = new ObjectReader();
		String input_file = "";
		String output_file = "wyniki.csv";
		if (args.length == 0) {
			input_file = "objects.csv";
		} else {
			input_file = args[0];
		}
		objects.createFromFile(input_file);
		
		
		// Create database connection
		Database db = new Database();
		db.setDatabaseFile(Configuration.getInstance().getDatabaseFile());
		db.connect();
		
		List<Map<String, Double>> tuples = db.getAllTuples("games");
		
		Generator generator = new Generator();
		for (Quantifier q : objects.getQuantifiers()) {
			generator.addQuantifier(q);
		}
		
		for (Variable v : objects.getVariables()) {
			generator.addVariable(v);
		}
		
		generator.generate();
		
		List<Summary> summaries = generator.getSummaries();
		
		// Clean old content of output file
		try {
			FileOutputStream erasor = new FileOutputStream(output_file);
			erasor.write(0);
			erasor.close();
		} catch (Exception e) {
			//
		}
		
		System.out.println("T1 \t T2 \t T3 \t T4 \t T5 \t T6 \t T7 \t T8 \t T9 \t T10 \t T11 \t T");
		for (Summary summary : summaries) {
			summary.setTuples(tuples);
			summary.qualityMeasures();
			//summary.show();
			
			Results results = summary.getResults();
			results.appendToFile(output_file);
			System.out.println(results + " | " + summary.getText());
		}
		
		System.out.println(input_file + " ===> " + output_file);
		*/
		
		
		// Testing of interval-valued sets
		/*
		Triangular lower = ObjectContructor.createTriangular(20, 0, 30, 1, 40, 0);
		Triangular upper = ObjectContructor.createTriangular(10, 0, 30, 1, 50, 0);
		Dense universe = new Dense(0, 100);
		IntervalFuzzySet1 iset1 = new IntervalFuzzySet1();
		iset1.setLowerMembershipFunction(lower);
		iset1.setUpperMembershipFunction(upper);
		iset1.setUniverseOfDiscorse(universe);
		
		iset1.addElement(15.0);
		iset1.addElement(30.0);
		iset1.addElement(35.0);
		
		iset1.getElements();
		*/
		
		// Lets try to create summarizer with interval-valued set
		Database db = new Database();
		db.setDatabaseFile(Configuration.getInstance().getDatabaseFile());
		db.connect();
		List<Map<String, Double>> tuples = db.getAllTuples("games");
				
		
		IntervalFuzzySet1 set = new IntervalFuzzySet1();
		
		Summarizer s1 = new Summarizer();
		s1.setColumn("min");
		s1.setName("grał około 30 minut");
		s1.setFuzzySet(set);
		
		s1.membershipValue(tuples.get(10));
		
		
		
		
		
		// Try read data from file :)

		Quantifier q1 = ObjectContructor.createQuantifier("W około 3000", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(2800.0, 0.0, 3000.0, 1.0, 3200.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 20000));
		Quantifier q2 = ObjectContructor.createQuantifier("W około 6000", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(5500.0, 0.0, 6000.0, 1.0, 6500.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 20000));
		Quantifier q3 = ObjectContructor.createQuantifier("W około 8000", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(7500.0, 0.0, 8000.0, 1.0, 8500.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 20000));
		Quantifier q4 = ObjectContructor.createQuantifier("W ponad 100", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(80.0, 0.0, 100.0, 1.0, 20000.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 20000));
		
		Quantifier q5 = ObjectContructor.createQuantifier("W prawie wszystkie", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.9, 0.0, 0.95, 1.0, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Quantifier q6 = ObjectContructor.createQuantifier("W połowie", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.45, 0.0, 0.50, 1.0, 0.55, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Quantifier q7 = ObjectContructor.createQuantifier("W mniej niż 1/4", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 0.20, 0.0, 0.25, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Quantifier q8 = ObjectContructor.createQuantifier("W ponad 3/4", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.70, 0.0, 0.75, 1.0, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		/*
		// Tabela min
		Summarizer s1_1 = ObjectContructor.createSummarizer("krótko", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(1.0, 1.0, 8.0, 1.0, 10.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60));
		Summarizer s1_2 = ObjectContructor.createSummarizer("wcale", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 1.0, 0.0, 60.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60));
		Summarizer s1_3 = ObjectContructor.createSummarizer("długo", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(20.0, 0.0, 33.0, 1.0, 60.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60));
		Summarizer s1_4 = ObjectContructor.createSummarizer("dogrywka", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(40.0, 0.0, 45.0, 1.0, 60.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60));
		Summarizer s1_5 = ObjectContructor.createSummarizer("cały mecz", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(39, 0.0, 40.0, 1.0, 60.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60));
		Summarizer s1_6 = ObjectContructor.createSummarizer("około 30 min", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(28.0, 0.0, 30.0, 1.0, 32.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60));
		
		s1_1.setColumn("min");
		s1_2.setColumn("min");
		s1_3.setColumn("min");
		s1_4.setColumn("min");
		s1_5.setColumn("min");
		s1_6.setColumn("min");
		
		// Tabela fgp - skuteczność w rzutach
		Summarizer s2_1 = ObjectContructor.createSummarizer("mała", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 0.15, 0.5, 0.3, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Summarizer s2_2 = ObjectContructor.createSummarizer("duża", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.85, 0.0, 0.98, 0.5, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Summarizer s2_3 = ObjectContructor.createSummarizer("przeciętna", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.3, 0.0, 0.34, 1.0, 0.38, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		
		s2_1.setColumn("fgp");
		s2_2.setColumn("fgp");
		s2_3.setColumn("fgp");
		
		// Tabela xxx
		Summarizer s3_1 = ObjectContructor.createSummarizer("mała", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 0.15, 0.5, 0.3, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Summarizer s3_2 = ObjectContructor.createSummarizer("duża", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.85, 0.0, 0.98, 0.5, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Summarizer s3_3 = ObjectContructor.createSummarizer("przeciętna", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.3, 0.0, 0.34, 1.0, 0.38, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		
		s3_1.setColumn("3pp");
		s3_2.setColumn("3pp");
		s3_3.setColumn("3pp");
		
		// Tabela xxx
		Summarizer s4_1 = ObjectContructor.createSummarizer("mała", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 0.15, 0.5, 0.3, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Summarizer s4_2 = ObjectContructor.createSummarizer("duża", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.85, 0.0, 0.98, 0.5, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		Summarizer s4_3 = ObjectContructor.createSummarizer("przeciętna", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.3, 0.0, 0.34, 1.0, 0.38, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1));
		
		s4_1.setColumn("ftp");
		s4_2.setColumn("ftp");
		s4_3.setColumn("ftp");
		
		// Tabela pf - liczba fauli
		Summarizer s5_1 = ObjectContructor.createSummarizer("agresywny", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(3.0, 0.0, 5.0, 0.7, 6.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 10));
		Summarizer s5_2 = ObjectContructor.createSummarizer("spokojny", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 2.0, 0.0, 10.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 10));
		
		s5_1.setColumn("pf");
		s5_2.setColumn("pf");
		
		// Table ast - liczba asyst
		Summarizer s6_1 = ObjectContructor.createSummarizer("dobry asystent", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(10.0, 0.0, 15.0, 0.6, 25.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 25));
		Summarizer s6_2 = ObjectContructor.createSummarizer("przeciętny asystent", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(4.0, 0.0, 7.0, 1.0, 10.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 25));
		Summarizer s6_3 = ObjectContructor.createSummarizer("przypadkowy asystent", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 0.0, 2.0, 1.0, 4.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 25));
		
		s6_1.setColumn("ast");
		s6_2.setColumn("ast");
		s6_3.setColumn("ast");
		
		// Tabela pts - punkty
		Summarizer s7_1 = ObjectContructor.createSummarizer("dużo", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(30.0, 0.0, 40.0, 0.5, 51.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 51));
		Summarizer s7_2 = ObjectContructor.createSummarizer("mało", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 15.0, 0.2, 30.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 51));
		Summarizer s7_3 = ObjectContructor.createSummarizer("około 25 punktów", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(20.0, 0.0, 25.0, 0.1, 30.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 51));
		
		s7_1.setColumn("pts");
		s7_2.setColumn("pts");
		s7_3.setColumn("pts");
		
		
		Summary summary = new Summary();
		summary.addQuantifier(q);
		summary.addSummarizer(s2_1);
		//summary.addSummarizer(s2);
		//summary.addQualifier(w1);
		summary.show();
		summary.setTuples(tuples);
		summary.qualityMeasures();
		*/
		//-------------------------
		
		Variable L1 = new Variable();
		L1.setName("czas gry");
		L1.setColumn("min");
		L1.setUniverse(new Dense(0.0, 100.0));
		L1.addFuzzySet("grano krótko", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(1.0, 1.0, 8.0, 1.0, 10.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60)), false);
		L1.addFuzzySet("nie grano wcale", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 1.0, 0.0, 60.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60)), false);
		L1.addFuzzySet("grano długo", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(20.0, 0.0, 33.0, 1.0, 60.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60)), false);
		L1.addFuzzySet("grano w dogrywce", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(40.0, 0.0, 45.0, 1.0, 60.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60)), false);
		L1.addFuzzySet("grano przez cały mecz", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(39, 0.0, 40.0, 1.0, 60.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60)), false);
		L1.addFuzzySet("grano około 30 min", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(28.0, 0.0, 30.0, 1.0, 32.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60)), false);
		
		Variable L2 = new Variable();
		L2.setName("skuteczność w rzutach");
		L2.setColumn("fgp");
		L2.setUniverse(new Dense(0.0, 1.0));
		L2.addFuzzySet("niska skuteczność", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 0.15, 0.5, 0.3, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		L2.addFuzzySet("duża skuteczność", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.85, 0.0, 0.98, 0.5, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		L2.addFuzzySet("przeciętna skuteczność", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.3, 0.0, 0.34, 1.0, 0.38, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		
		Variable L3 = new Variable();
		L3.setName("skuteczność w rzutach za 3 punkty");
		L3.setColumn("3pp");
		L3.setUniverse(new Dense(0.0, 1.0));
		L3.addFuzzySet("niska skuteczność w rzutach za 3 punkty", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 0.15, 0.5, 0.3, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		L3.addFuzzySet("duża skuteczność w rzutach za 3 punkty", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.85, 0.0, 0.98, 0.5, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		L3.addFuzzySet("przeciętna skuteczność w rzutach za 3 punkty", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.3, 0.0, 0.34, 1.0, 0.38, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		
		Variable L4 = new Variable();
		L4.setName("skuteczność w rzutach osobistych");
		L4.setColumn("ftp");
		L4.setUniverse(new Dense(0.0, 1.0));
		L4.addFuzzySet("niska skuteczność w rzutach osobistych", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 0.15, 0.5, 0.3, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		L4.addFuzzySet("duża skuteczność w rzutach osobistych", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.85, 0.0, 0.98, 0.5, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		L4.addFuzzySet("przeciętna skuteczność w rzutach osobistych", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.3, 0.0, 0.34, 1.0, 0.38, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 1)), false);
		
		Variable L5 = new Variable();
		L5.setName("brutalność gry zawodnika");
		L5.setColumn("pf");
		L5.setUniverse(new Dense(0.0, 10.0));
		L5.addFuzzySet("grał agresywnie", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(3.0, 0.0, 5.0, 0.7, 6.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 10)), true);
		L5.addFuzzySet("grał spokojnie", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 2.0, 0.0, 10.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 10)), false);
		
		Variable L6 = new Variable();
		L6.setName("wsparcie w zdobyciu punktów");
		L6.setColumn("ast");
		L6.setUniverse(new Dense(0.0, 25.0));
		L6.addFuzzySet("grał dobry asystent", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(10.0, 0.0, 15.0, 0.6, 25.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 25)), false);
		L6.addFuzzySet("grał przeciętny asystent", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(4.0, 0.0, 7.0, 1.0, 10.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 25)), false);
		L6.addFuzzySet("grał przypadkowy asystent", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 0.0, 2.0, 1.0, 4.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 25)), true);
		
		Variable L7 = new Variable();
		L7.setName("ilość zdobytych punktów");
		L7.setColumn("pts");
		L7.setUniverse(new Dense(0.0, 51.0));
		L7.addFuzzySet("zdobyto dużo punktów", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(30.0, 0.0, 40.0, 0.5, 51.0, 1.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 51)), false);
		L7.addFuzzySet("zdobto mało punktów", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.0, 1.0, 15.0, 0.2, 30.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 51)), false);
		L7.addFuzzySet("zdobyto około 25 punktów", ObjectContructor.createFuzzySet(IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(20.0, 0.0, 25.0, 0.1, 30.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 51)), false);
		
		
		/*
		Generator generator = new Generator();
		generator.addQuantifier(q1);
		generator.addQuantifier(q2);
		generator.addQuantifier(q3);
		generator.addQuantifier(q4);
		generator.addQuantifier(q5);
		generator.addQuantifier(q6);
		generator.addQuantifier(q7);
		generator.addQuantifier(q8);
		generator.addVariable(L1);
		generator.addVariable(L2);
		generator.addVariable(L3);
		generator.addVariable(L4);
		generator.addVariable(L5);
		generator.addVariable(L6);
		generator.addVariable(L7);
		generator.generate();
		*/
		
		//List<Summary> summaries = generator.getSummaries();
		
		//System.out.println("T1 \t T2 \t T3 \t T4 \t T5 \t T6 \t T7 \t T8 \t T9 \t T10 \t T11 \t T");
		/*for (Summary summary : summaries) {
			summary.setTuples(tuples);
			summary.qualityMeasures();
			//summary.show();
			
			Results results = summary.getResults();
			results.appendToFile("wyniki.txt");
			System.out.println(results + " | " + summary.getText());
		}*/
		
/***********************
		List<Double> universeBound = new ArrayList<>();
		universeBound.add(0.0);
		universeBound.add(1.0);
		Quantifier q1 = ObjectContructor.createQuantifier("ponad połowa", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(0.5, 0.0, 0.7, 1.0, 1.0, 1.0), IUniverseOfDiscourse.Type.DENSE, universeBound);
		Quantifier q2 = ObjectContructor.createQuantifier("około 3000", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(2800.0, 0.0, 3000.0, 1.0, 3200.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 20000));
		
		// Qualifier
		Summarizer s1 = ObjectContructor.createSummarizer("około 30", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(25.0, 0.0, 30.0, 1.0, 35.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 60));
		Summarizer s2 = ObjectContructor.createSummarizer("około 35", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(30.0, 0.0, 35.0, 1.0, 40.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 100));
		s1.setColumn("min");
		s2.setColumn("min");
		
		// Quantifier
		Qualifier w1 = ObjectContructor.createQualifier("średnio", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(4.0, 0.0, 7.0, 1.0, 10.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 33));
		Qualifier w2 = ObjectContructor.createQualifier("więcej", IFuzzySet.Type.TYPE1, MembershipFunction.Type.TRIANGULAR, ObjectContructor.createPoints3(7.0, 0.0, 10.0, 1.0, 13.0, 0.0), IUniverseOfDiscourse.Type.DENSE, ObjectContructor.createDenseUniverseBoundary(0, 33));
		w1.setColumn("fga");
		w2.setColumn("fga");
		
		Variable L1 = new Variable();
		L1.setName("Wiek");
		L1.setColumn("min");
		L1.setUniverse(new Dense(0, 100));
		L1.addFuzzySet("młody", new FuzzySetType1(), true);
		L1.addFuzzySet("w średnim wieku", new FuzzySetType1(), true);
		L1.addFuzzySet("stary", new FuzzySetType1(), true);
		L1.addFuzzySet("emeryt", new FuzzySetType1(), false);
		
		Variable L2 = new Variable();
		L2.setName("Wzrost");
		L2.setUniverse(new Dense(60, 250));
		
		Generator generator = new Generator();
		generator.addQuantifier(q1);
		generator.addQuantifier(q2);
		generator.addVariable(L1);
		generator.generate();
		List<Summary> summaries = generator.getSummaries();
		
		
		Summary summary = new Summary();
		summary.addQuantifier(q2);
		summary.addSummarizer(s1);
		//summary.addSummarizer(s2);
		//summary.addQualifier(w1);
		//summary.addQualifier(w2);
		summary.show();
		summary.setTuples(tuples);
		summary.qualityMeasures();
		Results results = summary.getResults();
		
		results.show();
		
/*		List<Summary> summaries = generator.getSummaries();
		
		for (Summary s : summaries) {
			s.show();
			s.setTuples(tuples);
			s.qualityMeasures();
			System.out.println("=======");
		}
*/
	
		
/***********************
		Dense universe = new Dense(0, 60);
		Triangular triangular = new Triangular(new Point(20.0, 0.0), new Point(30.0, 1.0), new Point(50.0, 0.0));
		
		FuzzySetType1 A = new FuzzySetType1();
		A.setUniverseOfDiscorse(universe);
		A.setMembershipFunction(triangular);
		
		Summarizer S1 = new Summarizer();
		S1.setName("średnio");
		S1.setColumn("min");
		S1.setFuzzySet(A);
		S1.putTuples(tuples);
		
		double s1 = S1.membershipValue(tuples.get(0));
		double s2 = S1.membershipValue(tuples.get(1));
		
		TNorm norm = new TNorm();
		
		double s = norm.min(s1, s2);
		System.out.println(s1);
		System.out.println(s2);
		System.out.println(s);
***********************/
		
		Interval i1 = new Interval(1.2, 1.2);
		double l = i1.toDouble();
		System.out.println(i1);
		
		System.out.println("Application stop: " + new Date());

	}

}
